package com.cwvs.utils;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public class PagesUtil {
	public static Pages initPages(HttpServletRequest request) {
		Pages pages = new Pages();
		String start = (String) request.getParameter("page");
		String limit = (String) request.getParameter("rows");
		pages.setCurrentPage(new Integer(
				(StringUtils.isNotBlank(start) && StringUtils.isNumeric(start)) ? start
						: "1"));
		pages.setPageSize(new Integer(
				(StringUtils.isNotBlank(limit) && StringUtils.isNumeric(limit)) ? limit
						: "10"));
		return pages;
	}
}
